<template>
  <a-card :bordered="false">
    <a-tabs v-model="activeKey" type="card">
      <a-tab-pane tab="指标模型监控" key="1">
        <sc-index-topic-model-monitor-list ref="scIndexTopicModelMonitorList" />
      </a-tab-pane>
      <a-tab-pane tab="数据表监控" key="2">
        <sc-index-topic-table-monitor-list ref="scIndexTopicModelMonitorList" />
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ScIndexTopicModelMonitorList from './ScIndexTopicModelMonitorList'
import ScIndexTopicTableMonitorList from './ScIndexTopicTableMonitorList'


export default {
  name: 'ScIndexTopicMonitorList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    ScIndexTopicModelMonitorList,
    ScIndexTopicTableMonitorList
  },
  data() {
    return {
      description: '指标模型监控管理页面',
      activeKey: '1',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '指标模型id',
          align: "center",
          dataIndex: 'topicId_dictText'
        },
        {
          title: '监控状态',
          align: "center",
          dataIndex: 'status_dictText'
        },
        {
          title: '监测时间',
          align: "center",
          dataIndex: 'monitorTime',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '指标数据表名称',
          align: "center",
          dataIndex: 'tableName'
        },
        {
          title: '监测类型',
          align: "center",
          dataIndex: 'type_dictText'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/index.monitor/scIndexTopicMonitor/list",
        delete: "/index.monitor/scIndexTopicMonitor/delete",
        deleteBatch: "/index.monitor/scIndexTopicMonitor/deleteBatch",
        exportXlsUrl: "/index.monitor/scIndexTopicMonitor/exportXls",
        importExcelUrl: "index.monitor/scIndexTopicMonitor/importExcel",

      },
      dictOptions: {},
      superFieldList: [],
    }
  },
  created() {
    this.getSuperFieldList();
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    initDictConfig() {
    },
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({ type: 'string', value: 'topicId', text: '指标模型id', dictCode: '' })
      fieldList.push({ type: 'string', value: 'status', text: '监控状态', dictCode: '' })
      fieldList.push({ type: 'date', value: 'monitorTime', text: '监测时间' })
      fieldList.push({ type: 'string', value: 'tableName', text: '指标数据表名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'type', text: '监测类型', dictCode: '' })
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>